<template>
  <div class="goods-box">
    <div>
      <div class="headerG">
        <el-header style="flex: 1; padding: 12px 0">
          <el-select v-model="value" placeholder="按照名称搜索">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>

          <el-input
            v-model="input"
            placeholder="关键字"
            class="order-input"
            style="width: 150px; height: 40px; margin-left: 10px"
          ></el-input>
          <el-button
            type="primary"
            icon="el-icon-search"
            style="margin-left: 10px"
            >搜索</el-button
          >
        </el-header>

        <div class="rightadd">
          <el-button type="text"
            ><i class="el-icon-plus"></i>添加分类</el-button
          >
        </div>
      </div>
    </div>
    <!-- 上是头部板块 下是表格板块 -->
    <div class="goodsmsg">
      <div class="goodstable">
        <el-table border style="" :data="tableData">
          <el-table-column label="商品名称">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row }}</span>
            </template>
          </el-table-column>
          <el-table-column label="商品描述" >
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row }}</span>
            </template>
          </el-table-column>
          <el-table-column label="商品规格">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row }}</span>
            </template>
          </el-table-column>
          <el-table-column label="商品价格" >
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row }}</span>
            </template>
          </el-table-column>
          <el-table-column label="商品状态" >
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row }}</span>
            </template>
          </el-table-column>

          <el-table-column label="操作选项">
            <template slot-scope="scope">
              <el-button
                size="mini"
                @click="handleEdit(scope.$index, scope.row)"
                >详情</el-button
              >
              <el-button
                size="mini"
                type="danger"
                @click="handleDelete(scope.$index, scope.row)"
                >修改</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="fenye">
        <el-pagination
          background
          layout="prev, pager, next"
          :total="total"
          :page-size="5"
          @current-change="changepage"
          :current-page="fenye.pageNum"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      input: "",
      fenye: {
        pageNum: 1,
        pageSize: 5,
      },
      options: [
        {
          value: "选项1",
          label: "按照名称搜索",
        },
        {
          value: "选项2",
          label: "按照描述搜索",
        },
      ],
      value: "",
      tableData: [],
    };
  },
  methods: {
    handleDelete(index, row) {
      console.log(index, row);
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    changepage(){
      console.log("淡定，待会再做");
    }
  },

  computed: {
     total() {
      //来自用户管理的数据
      return 0
    },
  },
};
</script>
<style>
.goods-box {
    width: 100%;
}
.headerG {
  padding: 18px 20px;
  /* width: 97%; */
  border-bottom: 1px solid #ebeef5;
  display: flex;
  text-align: center;
  justify-content: space-between;
}
.rightadd span {
  display: block;
  width: 117px;
  height: 36px;
  color: #fff;
  background-color: #409eff;
  border-color: #409eff;
  border-radius: 3px;
  line-height: 36px;
  text-align: center;
  font-size: 12px !important;
  cursor: pointer;
}
.rightadd span:hover {
  opacity: 0.8;
}
.goodsmsg {
  padding: 20px;
}
.goodstable {
  border: 1px solid #ebeef5;
}
.el-input__inner {
    height: 40px!important;
}
</style>